package com.application.chiettinhdienluc.utils;

import android.graphics.BitmapFactory;

import com.androidquery.AQuery;
import com.androidquery.callback.ImageOptions;
import com.application.chiettinhdienluc.R;
import com.application.chiettinhdienluc.app.MainApplication;



public class ImageOptionsUtils {
	
	public final static int SCREEN_WIDTH_MDPI = 480;	
	
	public final static int TARGET_WIDTH_IMAGE_GALLERY 		= 400;
	public final static int TARGET_WIDTH_IMAGE_FEED_LDPI 	= 320;
	public static final int FEED_THUMBSIZE_NORMAL			= 240;
	public static final int FEED_THUMBSIZE_SMALL 			= 160;
	
	private static ImageOptions opt_gallery_full;
	public static ImageOptions getImageOptionsGalleryFull()
	{
		if(opt_gallery_full == null)
		{
			opt_gallery_full = new ImageOptions();			
		    opt_gallery_full.memCache = true;
		    opt_gallery_full.fileCache = true;
		    opt_gallery_full.targetWidth = TARGET_WIDTH_IMAGE_GALLERY;
		    opt_gallery_full.preset = null;
		    opt_gallery_full.animation = AQuery.FADE_IN_NETWORK;
		}		
	    return opt_gallery_full;
	}
	
	private static ImageOptions opt_gallery;
	public static ImageOptions getImageOptionsGallery()
	{
		if(opt_gallery == null)
		{
			opt_gallery = new ImageOptions();			
		    opt_gallery.memCache = true;
		    opt_gallery.fileCache = true;
		    opt_gallery.targetWidth = 160;
		    opt_gallery.preset = BitmapFactory.decodeResource(MainApplication.getAppContext().getResources(), R.drawable.empty_photo);
		    opt_gallery.animation = AQuery.FADE_IN_NETWORK;
		}		
	    return opt_gallery;
	}
}